var config = require("config");
cc.Class({
    extends: cc.Component,

    properties: {
        title : {
            default : null,
            type : cc.Label
        },
        content : {
            default : null,
            type : cc.Label
        },
    },
    onLoad () { 
    },
    show(args){
        //金币不足邀请好友 重新进入游戏获得金币
        // this.title.string = args.title;
        // this.content.string = args.content;
        // this.enterCallback = args.enterCallback;
        // this.cancelCallback = args.cancelCallback;
    },
    enterClick(){
        cc.vv.audioMgr.playSFX("ui_button");
        if(this.enterCallback){
            this.enterCallback();
        }

        var index = config.getRandom(5);
        if(index == 0){
            index = 1;
        }
        var shareTxt = config.shareTxt[""+index][0];
        var shareImg = config.getShareImgPath(""+index);
        wx.shareAppMessage({
            title: shareTxt,
            imageUrl: shareImg,
            query : "key="+config.weiXinCode,
            success(res){
                console.log("---转发成功!!!");
            },
            fail(res){
                console.log("---转发失败!!!")
            }
        });
        this.node.destroy();
    },
    closeClick(){
        cc.vv.audioMgr.playSFX("ui_button");
        if(this.cancelCallback){
            this.cancelCallback();
        }
        this.node.destroy();
    },
});
